﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TeacherList.aspx.cs" Inherits="School.SystemManage.WebPages.SchoolIntro.TeacherList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <link href="../../css/right.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function CheckAll(checkBoxAll,isInTable) {
            var dataTable = document.getElementById("DataList");
            var checkBoxes = dataTable.getElementsByTagName("INPUT");
            var startIndex = 0;
            if (isInTable) {
                startIndex = 1;
            }
            for (var i = startIndex; i < checkBoxes.length; i++) {
                checkBoxes[i].checked = checkBoxAll.checked;
            }
        }

        function HasCheckedRow() {
            var dataTable = document.getElementById("DataList");
            var checkBoxes = dataTable.getElementsByTagName("INPUT");
            for (var i = 1; i < checkBoxes.length; i++) {
                if (checkBoxes[i].checked)
                    return confirm("确定要删除吗？");
            }
            alert("选择要删除的项");
            return false;
        }     
    </script>
    <style type="text/css">
        .td11{ width:10%;}
        .td21{ width:20%;}
        .td3{ width:10%;}
        .td4{ width:20%;}
        .td5{ width:10%;}
        .td6{ width:10%;}
        .td7{ width:20%;}
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="container">
        <div class="title_bg">
            <div class="floatLeft title_text_div">学院概况 > 师资队伍列表</div> 
            <ul class="floatRight">
                <li><input id="chk_Total" type="checkbox" class="floatLeft" onclick="CheckAll(this,false);" /><span class="checkAll floatLeft">全选</span><div class="clear"></div></li>
                <li class="add"><a href="TeacherEdit.aspx?action=add" runat="server" id="btnAdd">添加</a></li>
                <li class="delete">
                    <asp:LinkButton ID="lbtnDelete" runat="server" 
                        OnClientClick="return HasCheckedRow();" onclick="lbtnDelete_Click" >删除</asp:LinkButton></li>
            </ul>
            <div class="clear"></div>
        </div>
        <div>
            <asp:ListView ID="lv_teacher" runat="server" DataKeyNames="TID" 
                ItemPlaceholderID="PlaceHolder1" onitemcanceling="lv_teacher_ItemCanceling" 
                onitemediting="lv_teacher_ItemEditing" onitemupdating="lv_teacher_ItemUpdating">
                <LayoutTemplate>
                    <table cellspacing="0" id="DataList" class="dataTable">
                        <tr>
                            <th class="td11"><input id="chk_All" type="checkbox" onclick="CheckAll(this,true);" /></th>
                            <th class="td21">教师姓名</th>
                            <th class="td3">职务</th>
                            <th class="td4">职务名称</th>
                            <th class="td5">教学专业</th>
                            <th class="td6">排序</th>
                            <th class="td7">操作</th>
                        </tr>
                        <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
                    </table>
                </LayoutTemplate>
                <ItemTemplate>
                    <tr>
                        <td class="td11"><asp:CheckBox ID="cbChecked" runat="server"/></td>
                        <td class="td21"><%#Eval("TeacherName") %></td>
                        <td class="td3"><%#GetPositionName(Eval("Position").ToString())%></td>
                        <td class="td4"><%#Eval("PositionName") %></td>
                        <td class="td5"><%#GetMajor(Eval("Major").ToString())%></td>
                        <td class="td6"><%#Eval("TOrder") %></td>
                        <td class="td7">                           
                            <asp:LinkButton ID="lbtnOrder" runat="server" CommandName="Edit">排序</asp:LinkButton> |                             
                            <span runat="server" id="linkEditContainer"><a href='TeacherEdit.aspx?action=edit&tid=<%#Eval("TID") %>'>编辑</a></span>
                        </td>
                    </tr>
                </ItemTemplate>
                <EditItemTemplate>
                    <tr>
                        <td class="td11"><asp:CheckBox ID="cbChecked" runat="server"/></td>
                        <td class="td21"><%#Eval("TeacherName") %></td>
                        <td class="td3"><%#GetPositionName(Eval("Position").ToString())%></td>
                        <td class="td4"><%#Eval("PositionName") %></td>
                        <td class="td5"><%#GetMajor(Eval("Major").ToString())%></td>
                        <td class="td6"><asp:TextBox ID="txbOrder" runat="server" Text='<%#Eval("TOrder") %>' Width="50"></asp:TextBox></td>
                        <td class="td7">
                            <asp:LinkButton ID="lbtnOK" runat="server" CommandName="Update">确定</asp:LinkButton> | 
                            <asp:LinkButton ID="lbtnCancel" runat="server" CommandName="Cancel">取消</asp:LinkButton>
                        </td>
                    </tr>
                </EditItemTemplate>
            </asp:ListView>
        </div>
        <div class="red">
            <asp:Label ID="lblMsg" runat="server" Text=""></asp:Label></div>
     </div>
    </form>
</body>
</html>
